<template>
  <!-- 预警跟踪 -->
  <div class="warningTrack">
    <el-tabs v-model="active" tab-position="top" @tab-click="tabClick">
      <el-tab-pane
        v-for="item in panes"
        :key="item.key"
        :label="item.label"
        :name="item.key"
      >
      </el-tab-pane>
      <indexTable :active="active"></indexTable>
    </el-tabs>
  </div>
</template>

<script>
import indexTable from './indexTable'
import { modelList } from '@/api/handle'
export default {
  name: 'warningTrack',
  components: {
    indexTable
  },
  data() {
    return {
      active: '1',
      panes: [
        // { label: '家暴人员预警', key: '1' },
        // { label: '企业安全生产预警', key: '2' },
        // { label: '群租房预警', key: '3' },
        // { label: '企业欠薪预警', key: '4' },
        // { label: '高发预警', key: '5' }
      ]
    }
  },
  created() {
    this.modelList()
  },
  methods: {
    tabClick(val) {
      this.active = val.name
    },
    modelList() {
      modelList().then((res) => {
        if (res.success) {
          this.panes = []
          res.data.map((i) => {
            this.panes.push({
              label: i.modelName,
              key: i.modelType.toString()
            })
          })
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
</style>